﻿Module Module1
    Function Bai02(ByVal n As Integer) As Integer
        Dim S As Integer = 0
        Dim i As Integer
        For i = 0 To n Step 1
            S = S + i * i
        Next
        Return S
    End Function
    Sub Main()
        Dim n As Integer
        Console.WriteLine("Nhap So n: ")
        n = Console.ReadLine()
        Dim kq As Integer
        kq = Bai02(n)
        Console.WriteLine("S(n)= " & kq)
    End Sub
End Module
